home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple II Magazines (PO)
/
Nibble Volume 09, No. 08 (1988-08)(MicroSPARC)(Side A).zip
/
Nibble Volume 09, No. 08 (1988-08)(MicroSPARC)(Side A).po
/
GS.INFO.ASM.txt
< prev
next >
Wrap
Text File
|
1996-12-24
|
19KB
|
461 lines
**************************
* *
* GS INFO CDA *
* by Sandy Mossberg *
* *
* Copyright (C) 1987 *
* by MicroSPARC, Inc. *
* Concord, MA 01742 *
* *
**************************
SETCOM 36 ;comment line starts at 38
MCOPY GS.INFO.MAC ;name of macro file
KEEP GS.INFO ;name of load file
***| EQUATES |***************************************************
; Locations:
CH GEQU $24 ;column position
CV GEQU $25 ;row position
KVERSION GEQU $BFFF ;ProDOS 8 minor version
Key GEQU $E0C000 ;keyboard input
Strobe GEQU $E0C010 ;keyboard strobe
Toolbox GEQU $E10000 ;standard toolbox call
OS_ID GEQU $E100BC ;operating system ID
; 80-column screen commands:
NORMAL GEQU $8E ;enable normal text mode
INVERSE GEQU $8F ;enable inverse text mode
HOME GEQU $99 ;home cursor (no scrn clear)
***| MAIN PROGRAM |**********************************************
GS_Info START
USING GSI_Data
;................................................................
;
; CDA header:
;
STR 'GS Info' ;title of CDA
DC I4'GSI_Entry' ;startup entry to CDA
DC I4'GSI_Exit' ;shutdown entry to CDA
;................................................................
;
; Initialize:
;
GSI_Entry PHB ;save entry data bank
PHK ;equate program bank
PLB ; to data bank
JSL Set_S3 ;set text I/O for slot 3
;................................................................
;
; Print tool set info:
;
WRITECH #INVERSE ;set inverse text mode
WRITELN #' Current Status of Tool Sets: '
WRITECH #NORMAL ;set normal text mode
WRITELN ;CR
LDA #$601 ;start with STATUS call
STA TS_Status ; of 1st tool set
LDA #$401 ;start with VERSION call
STA TS_Version ; of 1st tool set
STZ Col_Flag ;flag 1st column
STZ TS_Loc ;point at start of table
Do_TS LDY TS_Loc
CPY TS_Num
BCS Do_Misc ;tool sets completed
CPY #14
BNE DTS1 ;still at 1st column
LDA #2 ;at 2nd column so return
JSR SetCV ; to top of list
LDA #$8000 ; and flag the
STA Col_Flag ; 2nd column
DTS1 JSR Get_TS ;print name of tool set
JSR Prt_TSInfo ;print tool set info
WRITELN ;CR
INC TS_Status ;bump status and version
INC TS_Version ; calls to next tool set
INC TS_Loc ;bump table position
BRA Do_TS ;loop back for more
;................................................................
;
; Print miscellaneous information:
;
Do_Misc WRITELN ;CR
WRITECH #INVERSE ;set inverse text mode
WRITELN #' Miscellaneous Information: '
WRITECH #NORMAL ;set normal text mode
WRITELN ;CR
WRITESTR #'Total Memory: '
JSR Get_TotalK ;print total memory K
WRITELN ;CR
WRITESTR #'Free Memory : '
JSR Get_FreeK ;print free memory K
WRITELN ;CR
WRITESTR #'> Free Block: '
JSR Get_BigK ;print largest block K
LDA #19 ;start new column
JSR SetCV ; at top of list
JSR SetCH_40
WRITESTR #'ProDOS '
JSR Get_Prodos ;print ProDOS stuff
;................................................................
;
; Print quit message:
;
LDA #23 ;bottom line
JSR SetCV
WRITESTR #'Press a key to quit '
WRITECH #INVERSE ;set inverse text mode
WRITECH #' ' ;print pseudo-cursor
WRITECH #NORMAL ;set normal text mode
;................................................................
;
; Update date and time until a key is pressed:
;
WRITECH #HOME ;home cursor (no scrn clear)
PHA ;reserve space for result
_GetIRQEnable ;check kbd interrupts
PLA ;get status word
STA IRQ_Flag ; and store it
AND #$80 ;isolate bit 7
BEQ Get_Time ;kbd interrupts disabled
PushWord #1 ;1=disable
_IntSource ;disable kbd interrupts
Get_Time LONGM ;set 16-bit memory and A-reg
JSR SetCH_40
PushLong #Time_ASCII ;ptr to ASCII time string
_ReadAsciiTime ;read the time
PushLong #Time_ASCII ;ptr to C-string
_WriteCString ;print the time
SHORTM ;set 8-bit memory and A-reg
LDA Key ;check for keypress
BPL Get_Time ;key up so update time
STA Strobe ;key down so clear strobe
LONGM ;set 16-bit memory and A-reg
LDA IRQ_Flag ;get entry interrupt status
AND #$80 ;isolate bit 7
BEQ Restore_S3 ;entry interrupts disabled
PushWord #0 ;0=enable
_IntSource ;re-enable kbd interrupts
;................................................................
;
; Restore entry I/O status and exit:
;
Restore_S3 JSL Restore_IO
PLB ;restore entry data bank
GSI_Exit RTL
***| SUBROUTINES |***********************************************
;
; Set horizontal cursor position to 40:
SetCH_40 LDA #40 ;fall into SetCH
; Set horizontal cursor position:
;
SetCH SHORTM ;set 8-bit memory and A-reg
STA >CH ;stuff into $000024
LONGM ;set 16-bit memory and A-reg
RTS
;................................................................
;
; Set vertical cursor position:
;
SetCV DEC A ;compensate for later CR
SHORTM ;set 8-bit memory and A-reg
STA >CV ;stuff into $000025
LONGM ;set 16-bit memory and A-reg
PHY ;protect Y-reg from TS call
WRITELN ;CR
PLY ;restore entry Y-reg
RTS
;................................................................
;
; Set column for tool set name:
;
SetCH_Name BIT Col_Flag
BPL SCN1 ;1st column at left margin
JSR SetCH_40 ;2nd column at CH=40
SCN1 RTS
;................................................................
;
; Set column for tool set status:
;
SetCH_Stat BIT Col_Flag
BPL SCS1 ;we're in 1st column
LDA #65 ;2nd column position
BRA SCS2
SCS1 LDA #25 ;1st column position
SCS2 JMP SetCH
;................................................................
;
; Print number and name of tool set:
;
; --> Locate table location of tool set name:
Get_TS JSR SetCH_Name ;set CH for TS name
SHORTM ;set 8-bit memory and A-reg
LDX #$FFFF ;prepare for X=0
GTS1 CPY #0
BEQ Print_TS ;table location found
GTS2 INX ;bump table index
LDA TS_Names,X ;get table char
BNE GTS2 ;not end of TS name
DEY ;end of TS name
BRA GTS1
; --> Print hex number of tool set:
Print_TS LONGM ;set 16-bit memory and A-reg
INX ;advance to next TS name
PHX ;save lo start addr of name
LDA TS_Loc ;to get tool set number,
INC A ; bump tool set location
PHA ;tool set number (hex)
PushLong #Hex_Num ;ptr to ASCII result
PushWord #2 ;length of ASCII string
_Int2Hex ;get ASCII of hex number
PushLong #Hex_Num ;ptr to C-string number
_WriteCString ;print C-string number
; --> Print name of tool set:
PLA ;restore lo addr of name
ADC #TS_Names ;add start addr of table
TAX ;save lo byte in X-reg
LDA #^TS_Names ;get hi start addr of table
ADC #0 ;pick up carry
PHA ;hi ptr to tableC-string
PHX ;lo ptr to table C-string
_WriteCString ;print table C-string
RTS
;................................................................
;
; Print tool set information:
;
; --> Print status of tool set:
Prt_TSInfo JSR SetCH_Stat ;set CH for TS status
STZ Load_Flag ;assume tool set loaded
PHA ;reserve space for result
LDX TS_Status ;make STATUS call
JSL Toolbox ; to tool set
PLA ;get Boolean result
BCC PI1 ;tool set loaded
LDA #$8000 ;signal that tool set
STA Load_Flag ; not loaded
LDA #'U' ;U=tool set unloaded
BRA Print_Stat
PI1 BEQ PI2 ;tool set inactive
LDA #'A' ;A=active tool set
BRA Print_Stat
PI2 LDA #'I' ;I=inactive tool set
Print_Stat WRITECH ;print tool set status
WRITESTR #' ' ;print 3 spaces
; --> Get version number of tool set:
BIT Load_Flag
BMI RTS1 ;not loaded so no version
WRITECH #'v' ;print "v"
PHA ;reserve space for result
LDX TS_Version ;make VERSION call
JSL Toolbox ; to tool set
PLA ;get result into A-reg
;................................................................
;
; Print version number:
;
Print_Vers PHA ;save 2 results
PHA ; on stack
XBA ;major version to lo byte
AND #$7F ;isolate major version
ORA #$B0 ;convert to ASCII
WRITECH ;print major version
WRITECH #'.' ;print period
PLA ;restore 1st result
AND #$FF ;isolate minor version
ORA #$B0 ;convert to ASCII
WRITECH ;print minor version
PLA ;restore 2nd result
BPL RTS1 ;not a prototype version
WRITECH #'p' ;indicate prototype stage
RTS1 RTS
;................................................................
;
; Print ProDOS version:
;
; --> Determine which operating system is active:
Get_Prodos LDA OS_ID
AND #$FF ;isolate lo byte
BNE ProDOS_16 ;ProDOS 16 running
; --> ProDOS 8 running:
WRITESTR #'8 v1.' ;major version always 1
LDA >KVERSION-1 ;minor version in hi byte
XBA ;minor version to lo byte
AND #$FF ;isolate lo byte
ORA #$B0 ;convert to ASCII
WRITECH ;print minor version
RTS
; --> ProDOS 16 running:
ToPD16_Err BRL PD16_Err
ProDOS_16 WRITESTR #'16 '
_GET_VERSION GVers_Parm ;get version
BCS ToPD16_Err ;error
WRITECH #'v'
LDA GV_Num ;get version number in A-reg
JSR Print_Vers ;print version number
WRITELN ;CR
JSR SetCH_40
WRITESTR #'Boot Volume: '
_GET_BOOT_VOL GBoot_Parm ;get name of boot volume
BCS PD16_Err ;error
WRITELN Boot_Name ;print name of boot volume
JSR SetCH_40
WRITESTR #'Application Name: '
_GET_PATH_NAME GName_Parm ;get name of application
BCS PD16_Err ;error
WRITESTR Appli_Name ;print name of application
RTS
PD16_Err WRITESTR #'busy' ;only error is BUSY error
RTS
;................................................................
;
; Print total memory in K:
;
Get_TotalK PHA ;reserve space for result
PHA
_TotalMem ;get total memory
BRA ToK_Mart ;convert to K
;................................................................
;
; Print free memory in K:
;
Get_FreeK PHA
PHA
_FreeMem ;get free memory
BRA ToK_Mart ;convert to K
;................................................................
;
; Print largest memory block in K:
;
Get_BigK PHA
PHA
_MaxBlock ;get largest block
ToK_Mart PLA ;memory hi
PLY ;memory lo
;................................................................
;
; Convert bytes to kilobytes. Enter with Y=hi word and A=lo word:
;
; --> Divide 4-byte value by 10:
K_Mart STY Memory_Hi ;hi word in memory
LDX #10 ;counter
K1 LSR Memory_Hi ;shift hi word
ROR A ;shift lo word
DEX
BNE K1 ;do it 10 times
; --> Convert result in A-reg to ASCII and print K value:
PHA ;K number
PushLong #Dec_Num ;ptr to ASCII result
PushWord #4 ;length of ASCII string
PushWord #0 ;unsigned number
_Int2Dec ;get ASCII of dec number
PushLong #Dec_Num ;ptr to C-string number
_WriteCString ;print C-string number
RTS
END
COPY SLOT3.IO.ASM
***| DATA |******************************************************
GSI_Data DATA
; Table of tool set names:
TS_Num DC I2'28' ;# tool sets
TS_Names DC C'Tool Locator',I1'0' ;$01
DC C'Memory Manager',I1'0' ;$02
DC C'Miscellaneous Tools',I1'0' ;$03
DC C'QuickDraw II',I1'0' ;$04
DC C'Desk Manager',I1'0' ;$05
DC C'Event Manager',I1'0' ;$06
DC C'Scheduler',I1'0' ;$07
DC C'Sound Manager',I1'0' ;$08
DC C'DeskTop Bus Tools',I1'0' ;$09
DC C'SANE',I1'0' ;$0A
DC C'Integer Math Tools',I1'0' ;$0B
DC C'Text Tools',I1'0' ;$0C
DC C'RAM Disk Tools',I1'0' ;$0D
DC C'Window Manager',I1'0' ;$0E
DC C'Menu Manager',I1'0' ;$0F
DC C'Control Manager',I1'0' ;$10
DC C'System Loader',I1'0' ;$11
DC C'QuickDraw Aux Tools',I1'0' ;$12
DC C'Print Manager',I1'0' ;$13
DC C'LineEdit',I1'0' ;$14
DC C'Dialog Manager',I1'0' ;$15
DC C'Scrap Manager',I1'0' ;$16
DC C'Stnd File Operations',I1'0' ;$17
DC C'Disk Utilities',I1'0' ;$18
DC C'Note Synthesizer',I1'0' ;$19
DC C'Note Sequencer',I1'0' ;$1A
DC C'Font Manager',I1'0' ;$1B
DC C'List Manager',I1'0' ;$1C
; Storage locations
TS_Status DS 2 ;tool set status call
TS_Version DS 2 ;tool set version number
TS_Loc DS 2 ;position in tool set table
Col_Flag DS 2 ;column flag (PL=1st,MI=2nd)
Load_Flag DS 2 ;load flag (MI=TS unloaded)
IRQ_Flag DS 2 ;IRQ flag (on=bit 7 set)
Hex_Num DS 2 ;ASCII string of hex number
DC C'-',I1'0' ;hyphen and zero terminator
Dec_Num DS 4 ;ASCII string of dec number
DC C'K',I1'0' ;"K" and zero terminator
Time_ASCII DS 20 ;always 20 chars
DC I1'0' ;zero terminator
Memory_Hi DS 2 ;hi order memory byte
Boot_Name DS 18 ;boot volume name string
Appli_Name DS 16 ;application name string
; Parameter list for ProDOS 16 call:
GVers_Parm ANOP ;GET_VERSION parms
GV_Num DS 2 ;lo=minor, hi=major
GBoot_Parm ANOP ;GET_BOOT_VOL parms
DC I4'Boot_Name' ;ptr to name of boot volume
GName_Parm ANOP ;GET_NAME parms
DC I4'Appli_Name' ;ptr to application name
END